<template>
	<view>
		<!-- 头像与账号密码 -->
		<image class="lejuLogo" src="../../../static/icons/leju-logo.png" mode=""></image>
		<view class="userId">
			<input type="text" v-model="value_id" />
		</view>
		<view class="userPwd">
			<input type="password" v-model="value_pwd" />
		</view>
		
		<!-- 登录按钮 -->
		<button type="default" class="btnLogin" @click="storeData">登 录</button>
		
		
		<!-- 找回密码与注册账号 -->
		<view class="bottom">
			<view class="findPwd">
				找回密码
			</view>
			<view class="regCount" @click="goRegister">
				注册账号
			</view>
		</view>
		
	</view>
</template>

<script>
	import {doLogin} from "@/api/user/index.js"
	export default {
		data() {
			return {
				value_id:"17596496508",
				value_pwd:"123456",
				list:[],
			}
		},
		
		methods: {
			storeData(){
				// uni.setStorageSync("ids",this.value_id)
				// uni.setStorageSync("password",this.value_pwd)
				doLogin({
					username:this.value_id,
					password:this.value_pwd
				}).then(res=>{
					console.log(res)
					this.list=res.data.token
					uni.setStorageSync("token",this.list)
				})
				uni.showToast({
						title:"登录成功,1s后进行跳转"
					})
				setTimeout(function(){
					
					uni.switchTab({
					url:"../user"
				})
				},1000)
				
			},
			goRegister(){
				uni.navigateTo({
					url:"register/register"
				})
			}
		}
	}
</script>


<style lang="scss">
	page {
		background-color: #F1ECE7;
	}
</style>

<style lang="scss" scoped>
	// 头像与账号密码
	.lejuLogo{
		display: block;
		width: 80px;
		height: 80px;
		margin: 0 auto;
		border-radius: 50%;
		margin: 64px auto 36px;
	}
	.userId{
		width: 273px;
		height: 18px;
		box-shadow: 0 0 30px 0 rgba(43,86,112,.1);
		margin: 12px auto;
		margin-bottom: 30px;
		padding: 16px;
		border-radius: 70px;
		input{
			
		}
	}
	.userPwd{
		width: 273px;
		height: 18px;
		box-shadow: 0 0 30px 0 rgba(43,86,112,.1);
		margin: 12px auto;
		padding: 16px;
		border-radius: 70px;
		input{
			
		}
	}
	// 登录
	.btnLogin{
		width: 272px;
		height: 50px;
		border-radius: 50px;
		background-color: rgb(53, 78, 68);
		color: #ffffff;
		font-size: 15px;
		line-height: 50px;
		margin-top: 48px;
	}
	//找回密码与注册账号
	.bottom{
		display: flex;
		justify-content: center;
		margin-top: 25px;
		.findPwd{
			font-size: 14px;
			padding-right:3px;
			border-right: 1px solid #000000 ;
		}
		.regCount{
			font-size: 14px;
			padding-left:3px;
		}
	}
</style>
